package com.tdkj.action.backstage.shop;

import java.util.List;

import javax.annotation.Resource;

import com.tdkj.action.BaseAction;
import com.tdkj.model.shop.BeanShelfCustom;
import com.tdkj.model.shop.BeanShelfDefault;
import com.tdkj.service.shop.IBeanShelfDefaultService;


public class ShelfDefaultAction extends BaseAction {
    
	private IBeanShelfDefaultService shelfDefaultService;
	
	
	private Long id;
	private Integer quantity;
	
	private BeanShelfDefault shelfDefault ;
	
	private List<BeanShelfCustom> shelfCustoms ;
	
	public String init() {
		shelfDefaultService.initShelfDefault();
		return execute();
	}
	
	public String update() {
		shelfDefaultService.updateShelfDefault(quantity);
		return execute();
	}
	
	public String execute() {
		shelfDefault = shelfDefaultService.getShelfDefault();
		shelfCustoms = shelfDefaultService.findAll(BeanShelfCustom.class);
		return "success";
	}

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the quantity
	 */
	public Integer getQuantity() {
		return quantity;
	}

	/**
	 * @param quantity the quantity to set
	 */
	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}

	/**
	 * @return the shelfDefault
	 */
	public BeanShelfDefault getShelfDefault() {
		return shelfDefault;
	}

	/**
	 * @param shelfDefault the shelfDefault to set
	 */
	public void setShelfDefault(BeanShelfDefault shelfDefault) {
		this.shelfDefault = shelfDefault;
	}

	/**
	 * @param shelfDefaultService the shelfDefaultService to set
	 */
	@Resource
	public void setShelfDefaultService(IBeanShelfDefaultService shelfDefaultService) {
		this.shelfDefaultService = shelfDefaultService;
	}

	/**
	 * @return the shelfCustoms
	 */
	public List<BeanShelfCustom> getShelfCustoms() {
		return shelfCustoms;
	}

	/**
	 * @param shelfCustoms the shelfCustoms to set
	 */
	public void setShelfCustoms(List<BeanShelfCustom> shelfCustoms) {
		this.shelfCustoms = shelfCustoms;
	}

}
